package com.mvc.web.common.utils;

import java.util.concurrent.TimeUnit;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.mvc.web.user.vo.UserVo;

public class CacheUtil {
	
	public static Cache<String, UserVo> cache = CacheBuilder.newBuilder()  
            .expireAfterWrite(24*15, TimeUnit.HOURS).maximumSize(10)  
            .build(); 
	
	public static void setcache(String key, UserVo value){
		cache.invalidate(key);
		cache.put(key, value);
	}
	
	public static UserVo getcache(String key){
		return cache.getIfPresent(key);
	}
	
}